package ModelLayer;

import java.util.ArrayList;

public class Apartment {
	private int apartId, apartNo, noOfRooms;
	private double monthlyRent, size, deposit, levyAmount, rateRooms, rateZone;
	private boolean autoLevy, autoRate, parkingBay;
	private Landlord landlord = new Landlord();
	private Building building = new Building();
	private ArrayList<Comment> comments = new ArrayList<>();
	private ArrayList<BeneficiaryPayment> beneficiaryPayments = new ArrayList<>();
	private ArrayList<RentalPayment> rentalPayments = new ArrayList<>();
	private ArrayList<Contract> contracts = new ArrayList<>();

	public Apartment() {}
	
	public Apartment(int apartId) {
		this.apartId = apartId;
	}

	public Apartment(int apartId, int apartNo, double monthlyRent,int noOfRooms, double size, double deposit, double levyAmount,double rateRooms,double rateZone, Boolean autoLevy, Boolean autoRent,Boolean parkingBay) {
		this.apartId = apartId;
		this.apartNo = apartNo;
		this.noOfRooms = noOfRooms;
		this.monthlyRent = monthlyRent;
		this.size = size;
		this.deposit = deposit;
		this.levyAmount = levyAmount;
		this.setRateRooms(rateRooms);
		this.setRateZone(rateZone);
	}

	public int getApartId() {
		return apartId;
	}

	public void setApartId(int apartId) {
		this.apartId = apartId;
	}

	public int getApartNo() {
		return apartNo;
	}

	public void setApartNo(int apartNo) {
		this.apartNo = apartNo;
	}

	public int getNoOfRooms() {
		return noOfRooms;
	}

	public void setNoOfRooms(int noOfRooms) {
		this.noOfRooms = noOfRooms;
	}

	public double getMonthlyRent() {
		return monthlyRent;
	}

	public void setMonthlyRent(double monthlyRent) {
		this.monthlyRent = monthlyRent;
	}

	public double getSize() {
		return size;
	}

	public void setSize(double size) {
		this.size = size;
	}

	public double getDeposit() {
		return deposit;
	}

	public void setDeposit(double deposit) {
		this.deposit = deposit;
	}

	public double getLevyAmount() {
		return levyAmount;
	}

	public void setLevyAmount(double levyAmount) {
		this.levyAmount = levyAmount;
	}



	public boolean isAutoLevy() {
		return autoLevy;
	}

	public void setAutoLevy(boolean autoLevy) {
		this.autoLevy = autoLevy;
	}

	public boolean isAutoRate() {
		return autoRate;
	}

	public void setAutoRate(boolean autoRate) {
		this.autoRate = autoRate;
	}

	public boolean isParkingBay() {
		return parkingBay;
	}

	public void setParkingBay(boolean parkingBay) {
		this.parkingBay = parkingBay;
	}

	public Landlord getLandlord() {
		return landlord;
	}

	public void setLandlord(Landlord landlord) {
		this.landlord = landlord;
	}

	public ArrayList<Comment> getComments() {
		return comments;
	}

	public void setComments(ArrayList<Comment> comments) {
		this.comments = comments;
	}

	public void addComment(Comment comment) {
		comments.add(comment);
	}

	public void removeComment(Comment comment) {
		comments.remove(comment);
	}

	public ArrayList<RentalPayment> getRentalPayments() {
		return rentalPayments;
	}

	public void setRentalPayments(ArrayList<RentalPayment> rentalPayments) {
		this.rentalPayments = rentalPayments;
	}

	public void addRentalPayments(RentalPayment rentalPayment) {
		rentalPayments.add(rentalPayment);
	}

	public void deleteRentalPayment(int rentId) {
		for (RentalPayment rentP : rentalPayments)
			if (rentP.getPaymentId() == rentId)
				rentalPayments.remove(rentP);
	}

	public ArrayList<BeneficiaryPayment> getBeneficiaryPayments() {
		return beneficiaryPayments;
	}

	public void setBeneficiaryPayments(
			ArrayList<BeneficiaryPayment> beneficiaryPayments) {
		this.beneficiaryPayments = beneficiaryPayments;
	}

	public void addBeneficiaryPayments(BeneficiaryPayment newBeneficiaryPayment) {
		beneficiaryPayments.add(newBeneficiaryPayment);
	}

	public void deleteBeneficiaryPayment(int benId) {
		for (BeneficiaryPayment benP : beneficiaryPayments)
			if (benP.getPaymentId() == benId)
				beneficiaryPayments.remove(benP);
	}

	public ArrayList<Contract> getContracts() {
		return contracts;
	}

	public void setContracts(ArrayList<Contract> contracts) {
		this.contracts = contracts;
	}

	public void addContracts(Contract newContract) {
		contracts.add(newContract);
	}

	public Building getBuilding() {
		return building;
	}

	public void setBuilding(Building building) {
		this.building = building;
	}

	public double getRateZone() {
		return rateZone;
	}

	public void setRateZone(double rateZone) {
		this.rateZone = rateZone;
	}

	public double getRateRooms() {
		return rateRooms;
	}

	public void setRateRooms(double rateRooms) {
		this.rateRooms = rateRooms;
	}
	
	
	public double getRate() {
		return getRateRooms()+getRateZone();
	}
}
